#include <iostream>

using namespace std;
int Prowermod(int a, int n, int b)
{
    int ans = 1;
    a = a % b;
    while (n)
    {
        if (n & 1)
            ans = ans * a % b;
        n /= 2;
        a = a * a % b;
    }
    return ans;
}
int main()
{
    int x = Prowermod(2, 128, 10);
    cout << x << endl;
    return 0;
}